package com.bear.newsset.entity;

import androidx.annotation.NonNull;

/**
 * 新闻参数实体
 * 所有参数均可不填
 */
public class NewsParamEntity extends BaseEntity {
    private String kw;              //关键词。通过符号“,”分割内容
    private long mainLableId;       //主标签。例如：1000
    private long childLableId;      //子标签。例如：11000
    private String dateRange;       /*时间戳范围,左边的时间戳不能超过30天，右边的时间戳不能超过当天23:59:59。
    不填默认查询近30天的数据。注意：Java的时间毫秒需要 / 1000
    例如：1555084800,1555171199。代表：2019/4/13 0:0:0,2019/4/13 23:59:59 */
    private String pageToken;       //翻页值
    private String site;            //新闻网站地址，不填默认所有。例如：qq.com
    private String sourceRegion = "中国";    //地区。例如：中国
    private String version;         //接口版本。

    public NewsParamEntity() { }

    public NewsParamEntity(String pageToken) {
        this.pageToken = pageToken;
    }

    public NewsParamEntity(long mainLableId, long childLableId) {
        this.mainLableId = mainLableId;
        this.childLableId = childLableId;
    }

    @Override
    public String toString() {
        return "NewsParamEntity{" +
                "kw='" + kw + '\'' +
                ", mainLableId=" + mainLableId +
                ", childLableId=" + childLableId +
                ", dateRange='" + dateRange + '\'' +
                ", pageToken='" + pageToken + '\'' +
                ", site='" + site + '\'' +
                ", sourceRegion='" + sourceRegion + '\'' +
                ", version='" + version + '\'' +
                '}';
    }

    public NewsParamEntity setParam(@NonNull NewsParamEntity entity) {
        kw = entity.getKw();
        mainLableId = entity.getMainLableId();
        childLableId = entity.getChildLableId();
        dateRange = entity.getDateRange();
        pageToken = entity.getPageToken();
        site = entity.getSite();
        sourceRegion = entity.getSourceRegion();
        version = entity.getVersion();
        return this;
    }

    public NewsParamEntity clean() {
        kw = dateRange = pageToken = site = version = null;
        mainLableId = childLableId = 0;
        sourceRegion = "中国";
        return this;
    }

    public String getKw() {
        return kw;
    }

    public NewsParamEntity setKw(String kw) {
        this.kw = kw;
        return this;
    }

    public long getMainLableId() {
        return mainLableId;
    }

    public NewsParamEntity setMainLableId(long mainLableId) {
        this.mainLableId = mainLableId;
        return this;
    }

    public long getChildLableId() {
        return childLableId;
    }

    public NewsParamEntity setChildLableId(long childLableId) {
        this.childLableId = childLableId;
        return this;
    }

    public String getDateRange() {
        return dateRange;
    }

    public NewsParamEntity setDateRange(String dateRange) {
        this.dateRange = dateRange;
        return this;
    }

    public String getPageToken() {
        return pageToken;
    }

    public NewsParamEntity setPageToken(String pageToken) {
        this.pageToken = pageToken;
        return this;
    }

    public String getSite() {
        return site;
    }

    public NewsParamEntity setSite(String site) {
        this.site = site;
        return this;
    }

    public String getSourceRegion() {
        return sourceRegion;
    }

    public NewsParamEntity setSourceRegion(String sourceRegion) {
        this.sourceRegion = sourceRegion;
        return this;
    }

    public String getVersion() {
        return version;
    }

    public NewsParamEntity setVersion(String version) {
        this.version = version;
        return this;
    }
}
